package framework.editors
{

	public class XMLEditor implements IEditor
	{
		public function XMLEditor()
		{
		}

		public function canRead(obj:*, propName:Object):int
		{
			if (obj is XMLList || obj is XML)
				return 2;
			return 0;
		}

		public function canWrite(obj:*, propName:Object):int
		{
			if (obj is XMLList || obj is XML)
				return 2;
			return 0;
		}

		public function read(obj:*, propName:Object):*
		{
			var r:String = obj[propName];
			if (!r)
			{
				r = obj["@" + propName];
			}
			if (r == "null")
				return null;
			if (r == "false")
				return false;

			return r;
		}

		public function write(obj:*, propName:Object, value:*):void
		{
			obj[propName] = value;
		}
	}
}